import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import './registerServiceWorker'

Vue.config.productionTip = false

// 1.  配置全局的样式 
import "@/assets/styles/index.scss"

// 2. 淘宝适配 
import "lib-flexible"

// 3. 全局引入 vant
import Vant from "vant"
import 'vant/lib/index.css';
Vue.use(Vant)

// 4.全局混入 变量 mixins
import "@/utils/mixins"

// 5. 全局注册组件
import "@/components"

// 6. 挂载 事件总线
Vue.prototype.$bus = new Vue()   // this.$bus 

// 7. 挂载axios 
import {axios} from "@/api/request"
Vue.prototype.$axios = axios

// 8. 挂载 http
import {http} from "@/api"
Vue.prototype.$http = http

// 9.全局指令+ 过滤器
import "@/utils/golbal"

new Vue({
  watch:{   // 监听路由切换 
    '$route':function(to,from){
       localStorage.setItem('fromName',from.name); // 从哪里来的路由 
    }
  },
  router,   // this.$router 
  store,    // this.$store  
  render: h => h(App)
}).$mount('#app')
